<template>
  <div class="wrapper">
    <div class="uc-main clearfix">
      <div class="uc-aside">
        <user-menu></user-menu>
      </div>
      <div class="uc-content">
        <div class="uc-panel">
          <div class="uc-bigtit">修改邮箱</div>
          <div class="uc-panel-bd">
            <div class="account-info clearfix" >
            <el-form class="col-userinfo"  ref="form" :model="form" label-width="80px">
              <el-form-item  label="邮箱">
                <el-input style="width: 320px"  class="bd" v-model="form.email"></el-input>
              </el-form-item>
              <el-button style="background: #ff0000; color: #ffffff; width: 320px" class="tj" type="submit" @click="modifyEmail">修改</el-button>
            </el-form>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import UserMenu from './UserMenu'
import http from '../../../base/api/http'
export default {
  name: 'UserEmailWrapper',
  components: {
    UserMenu
  },
  data () {
    return {
      form: {
        email: null
      }
    }
  },
  methods: {
    modifyEmail () {
      http.requestPost('/java/api/user/userEmailModify', this.form).then((res) => {
        if (res.status === 0) {
          alert('修改成功')
        } else {
          alert(res.msg)
        }
      })
    },
    getEmail () {
      http.requestQuickGet('/java/api/user/getUserEmail').then((res) => {
        if (res.status === 0) {
          this.form = res.data
        } else {
          alert(res.msg)
        }
      })
    }
  },
  mounted () {
    this.getEmail()
  }
}
</script>
<style></style>
